<template>
    <div class="query_tool">
        <div class="item">
            <span class="lable">会员姓名</span>
            <div class="value">
                <el-input v-model="queryValue.name" placeholder="请输入会员名称" clearable />
            </div>
        </div>
        <div class="item">
            <span class="lable">会员手机</span>
            <div class="value">
                <el-input v-model="queryValue.phone" placeholder="请输入会员手机号" clearable />
            </div>
        </div>
        <div class="item">
            <span class="lable">商品名称</span>
            <div class="value">
                <el-input v-model="queryValue.commodity" placeholder="请输入商品名称" clearable />
            </div>
        </div>
        <el-button @click="queryList" type="primary" size="medium">查询</el-button>
        <el-button @click="openDialog" type="warning" size="medium">新增</el-button>
    </div>
    <div class="content">
        <el-table :data="tableData" style="width: 100%">
            <el-table-column prop="id" label="ID" width="80"></el-table-column>
            <el-table-column prop="userName" label="姓名" width="80"></el-table-column>
            <el-table-column prop="userPhone" label="手机号" width="100"></el-table-column>
            <el-table-column prop="net" label="消费金额" width="80"></el-table-column>
            <el-table-column prop="integral" label="增加积分" width="80"></el-table-column>
            <el-table-column prop="commodityName" label="商品"></el-table-column>
            <el-table-column prop="remarks" label="备注" width="200"></el-table-column>
            <el-table-column fixed="right" label="操作" width="140">
                <template v-slot="scope">
                    <!--<el-button @click="edit(scope.row)" type="text">编辑</el-button>
                    <el-divider direction="vertical" />-->
                    <el-button @click="edit(scope.row)" type="text">订单详情</el-button>
                    <el-divider direction="vertical"></el-divider>
                    <delButton @del="dele(scope.row.id)"></delButton>
                </template>
            </el-table-column>
        </el-table>
        <el-pagination
                :hide-on-single-page="true"
                background
                layout="prev, pager, next"
                v-model:currentPage="page.current"
                @currentChange="getList"
                :total="page.total">
        </el-pagination>
    </div>
    <RecordDialog ref="dialogDom" :title="dialogTitle" @ok="getList"></RecordDialog>
</template>

<script>
import delButton from '../../components/del-button.vue'
import RecordDialog from './RecordDialog.vue'
import { querySetup } from "../User/UserQuery";
import { getRecord, deleRecord } from '../../api/api.js'
import { setupDialog } from "../Commodity/setupDialog";
export default {
    name: 'Record',
    components: { RecordDialog, delButton },
    setup(props, refs) {
        const queryOtion = querySetup(getRecord, deleRecord)
        const dialogData = setupDialog('新增记录', '订单详情')
        return {
            ...queryOtion,
            ...dialogData,
        }
    }
}
</script>

<style lang="less" scoped>
@import "../../assets/css/queryTool.less";
</style>
